const mainFun = (app) => {
    const router = require('../router');    
    const routerLogin = require('../router/user')
    const routerFile = require('../router/file')
    const routerLog = require('../router/log')
    app.use((req, res, next) => {
        // 设置CORS头信息，例如允许所有源或特定源等
        res.header('Access-Control-Allow-Origin', '*'); // 允许来自特定源的请求
        res.header('Access-Control-Allow-Methods', '*'); // 允许的方法列表
        res.header('Access-Control-Allow-Headers', 'Content-Type'); // 允许的头部列表
        res.header('Content-Type', 'application/json;chartset=utf-8')
        // res.header('Access-Control-Allow-Credentials', 'true'); // 允许发送Cookies等认证信息
        next(); // 继续其他中间件或路由处理
    });
    app.use('/api', router)
    app.use('/api', routerLogin)
    app.use('/api', routerFile)
    app.use('/api', routerLog)

}
module.exports = mainFun